package cn.wolfcode.web.controller;

import cn.wolfcode.domain.MessageReply;
import cn.wolfcode.domain.SystemDictionary;
import cn.wolfcode.qo.MessageReplyQueryObject;
import cn.wolfcode.service.IMessageReplyService;
import cn.wolfcode.service.ISystemDictionaryService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;


@Controller
@RequestMapping("/messageBoard")
public class MessageReplyController {

    @Autowired
    private IMessageReplyService messageReplyService;

    @Autowired
    private ISystemDictionaryService systemDictionaryService;

    @RequestMapping("/detail")
    public String show(Model model, Long id ) {

        if (id != null) {
            MessageReply messageReply = messageReplyService.get(id);
            model.addAttribute("messageReply", messageReply);
        }
        return "messageBoard/detail";
    }

//    @RequestMapping("/list")
//    public String list(Model model, @ModelAttribute("qo") MessageReplyQueryObject qo) {
//        PageInfo<MessageReply> pageInfo = messageReplyService.query(qo);
//        model.addAttribute("pageInfo", pageInfo);
//
//        List<SystemDictionary> catalogs = systemDictionaryService.queryBySn("business");
//        model.addAttribute("catalogs", catalogs);
//        return "messageBoard/detail";
//    }

}
